<?php
/**
 * 管理
 *
 * @package ews
 * @ews Enterprise WorkShop
 * @version 1.0
 * @since 2011-06-03
 * @author monkee
 */

class tagApp extends app
{
	public function update(){
		$postdata = & $this->getData('post');
		$tags = trim($postdata['tags']);
		$relate_id = intval($postdata['id']);
		$type = $postdata['type'];
		if(!in_array($type, array('know'))){
			return array('message'=>'未知类型');
		}
		if($relate_id == 0){
			return array('message'=>'参数有误');
		}
		$model = & $this->getModel('model');
		$model_id = $model->get_model_id($type, $relate_id);
		if($model_id==0){
			return arrray();
		}
		$model->update_tags($model_id, $tags);
		$tag = & $this->getModel('tag');
		$tag->update($model_id, $tags);
		return array();
	}
	
	public function search(){
		$tag = & $this->getData('get/tag');
		$tagobj = & $this->getModel('tag');
		$feeds = $tagobj->search($tag);
		return array('feeds' => $feeds, 'tag' => $tag);
	}
}
?>